﻿using DimensionsHelper.SourceGeneration.Resources;
using Microsoft.CodeAnalysis;
using System;

namespace DimensionsHelper.SourceGeneration.CommandLine
{

    internal static class CommandLineDiagnostics
    {

        private const string DimensionsHelperCLSourceGenerationName = "DimensionsHelper.CommandLine.SourceGeneration";


        private static DiagnosticDescriptor CreateDescriptor(string id, LocalizableString title, LocalizableString message, string category, DiagnosticSeverity severity, bool isEnabledByDefault = true, LocalizableString description = null)
        {
            return new DiagnosticDescriptor(id, title, message, category, severity, isEnabledByDefault, description);
        }


        private static readonly Type ResourceSource = typeof(Messages);


        public static DiagnosticDescriptor DuplicateArgumentName { get; } = CreateDescriptor(
            "DHCL1001",
            new LocalizableResourceString(nameof(Messages.DuplicateArgumentNameTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.DuplicateArgumentName), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);

        public static DiagnosticDescriptor ContextClassMustBePartial { get; } = CreateDescriptor(
            "DHCL1002",
            new LocalizableResourceString(nameof(Messages.DuplicateArgumentNameTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.DuplicateArgumentName), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);

        public static DiagnosticDescriptor ObjectMustHasParameterlessConstructor { get; } = CreateDescriptor(
            "DHCL1003",
            new LocalizableResourceString(nameof(Messages.ObjectMustHasParameterlessConstructorTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.ObjectMustHasParameterlessConstructor), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);


        public static DiagnosticDescriptor MissingDictionaryKeyProperty { get; } = CreateDescriptor(
            "DHCL1004",
            new LocalizableResourceString(nameof(Messages.MissingDictionaryKeyPropertyTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.MissingDictionaryKeyProperty), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);

        public static DiagnosticDescriptor MissingDictionaryValueProperty { get; } = CreateDescriptor(
            "DHCL1005",
            new LocalizableResourceString(nameof(Messages.MissingDictionaryValuePropertyTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.MissingDictionaryValueProperty), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);

        public static DiagnosticDescriptor ArgumentContextAttributeOnNonContextType { get; } = CreateDescriptor(
            "DHCL1006",
            new LocalizableResourceString(nameof(Messages.ArgumentContextAttributeOnNonContextTypeTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.ArgumentContextAttributeOnNonContextType), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);

        public static DiagnosticDescriptor PropertyHasDictionaryAttribute { get; } = CreateDescriptor(
            "DHCL1007",
            new LocalizableResourceString(nameof(Messages.PropertyHasDictionaryAttributeTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.PropertyHasDictionaryAttribute), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);

        public static DiagnosticDescriptor DuplicateDictionaryKey { get; } = CreateDescriptor(
            "DHCL1008",
            new LocalizableResourceString(nameof(Messages.DuplicateDictionaryKeyTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.DuplicateDictionaryKey), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);


        public static DiagnosticDescriptor DuplicateDictionaryValue { get; } = CreateDescriptor(
            "DHCL1009",
            new LocalizableResourceString(nameof(Messages.DuplicateDictionaryValueTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.DuplicateDictionaryValue), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);


        public static DiagnosticDescriptor PropertyWithoutGetter { get; } = CreateDescriptor(
            "DHCL1010",
            new LocalizableResourceString(nameof(Messages.PropertyWithoutGetterTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.PropertyWithoutGetter), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);


        public static DiagnosticDescriptor PropertyWithoutSetterAndTypeIsNullable { get; } = CreateDescriptor(
            "DHCL1011",
            new LocalizableResourceString(nameof(Messages.PropertyWithoutSetterAndTypeIsNullableTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.PropertyWithoutSetterAndTypeIsNullable), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);


        public static DiagnosticDescriptor UnsupportedGenericType { get; } = CreateDescriptor(
            "DHCL1012",
            new LocalizableResourceString(nameof(Messages.UnsupportedGenericTypeTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.UnsupportedGenericType), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);


        public static DiagnosticDescriptor PropertyTypeIsNotDictionary { get; } = CreateDescriptor(
            "DHCL1013",
            new LocalizableResourceString(nameof(Messages.PropertyTypeIsNotDictionaryTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.PropertyTypeIsNotDictionary), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);


        public static DiagnosticDescriptor ShouldSetPropertyBinding { get; } = CreateDescriptor(
            "DHCL1014",
            new LocalizableResourceString(nameof(Messages.ShouldSetPropertyBindingTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.ShouldSetPropertyBinding), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);


        public static DiagnosticDescriptor UnsupportedDictionaryKeyOrValueType { get; } = CreateDescriptor(
            "DHCL1015",
            new LocalizableResourceString(nameof(Messages.UnsupportedDictionaryKeyOrValueTypeTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.UnsupportedDictionaryKeyOrValueType), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);


        public static DiagnosticDescriptor PropertyHasBoundToDictionaryKey { get; } = CreateDescriptor(
            "DHCL1016",
            new LocalizableResourceString(nameof(Messages.PropertyHasBoundToDictionaryKeyTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.PropertyHasBoundToDictionaryKey), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);


        public static DiagnosticDescriptor PropertyHasBoundToDictionaryValue { get; } = CreateDescriptor(
            "DHCL1017",
            new LocalizableResourceString(nameof(Messages.PropertyHasBoundToDictionaryValueTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.PropertyHasBoundToDictionaryValue), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);


        public static DiagnosticDescriptor UnsupportedBindingPropertyType { get; } = CreateDescriptor(
            "DHCL1018",
            new LocalizableResourceString(nameof(Messages.UnsupportedBindingPropertyTypeTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.UnsupportedBindingPropertyType), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);
        

        public static DiagnosticDescriptor BindingPropertyIsNotExist { get; } = CreateDescriptor(
            "DHCL1019",
            new LocalizableResourceString(nameof(Messages.BindingPropertyIsNotExistTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.BindingPropertyIsNotExist), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);


        public static DiagnosticDescriptor PropertyCantBindToInterface { get; } = CreateDescriptor(
            "DHCL1020",
            new LocalizableResourceString(nameof(Messages.PropertyCantBindToInterfaceTitle), Messages.ResourceManager, ResourceSource),
            new LocalizableResourceString(nameof(Messages.PropertyCantBindToInterface), Messages.ResourceManager, ResourceSource),
            DimensionsHelperCLSourceGenerationName,
            DiagnosticSeverity.Warning);


    }

}